<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title></title>
		<script type="text/javascript">
			//要求，定义个公共的方法，能够实现只需要接收要互换的两个节点，然后调用这个方法，节点实现互换
					
					window.onload=function(){
					function fun(a,b){
						
					 var getid=document.getElementById(a);
					 var getid1=document.getElementById(b);
					 
					 var clone1=getid.cloneNode(true);
					 var clone2=getid1.cloneNode(true);
					 
					 var parent1=getid.parentNode;
					 var parent2=getid1.parentNode;
					  
					parent1.replaceChild(clone2,getid); 
					parent2.replaceChild(clone1,getid1);
					
					
					
					
			}		
			fun("bj","rl");  
		}
	
		</script>
	</head>
	<body>
			<ul id="city">
			<li id="bj" name="BeiJing">北京</li>
			<li>上海</li>
			<li>东京</li>
			<li>首尔</li>
		</ul>
		
		<br><br>
		<p>你喜欢哪款单机游戏?</p>
		<ul id="game">
			<li id="rl">红警</li>
			<li>实况</li>
			<li>极品飞车</li>
			<li>魔兽</li>
		</ul>
	</body>
</html>
